package com.exp.bookhouse.controller;

import com.exp.bookhouse.pojo.Category;
import com.exp.bookhouse.service.CategoryService;
import com.exp.bookhouse.util.ApiJSONResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "类别接口", tags = "类别操作")
@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @ApiOperation(value = "获取全部类别信息")
    @GetMapping
    public ApiJSONResult queryAllCategory(){
        List<Category> allCategory = categoryService.queryAllCategory();
        return ApiJSONResult.ok(allCategory);
    }





}
